# Copyright (c) 2019 Presto Labs Pte. Ltd.
# Author: leon

import functools

from coin.exchange.binance_futures.book_builder import BinanceFuturesBookBuilder
from coin.exchange.binance_futures.kr_rest.futures_product import BinanceFuturesProduct
from coin.exchange.binance.ws.handler import BinanceHandlerBase


class FuturesTraits(object):
  @classmethod
  @functools.lru_cache(maxsize=128)
  def get_product_from_symbol(cls, symbol, timestamp):
    return BinanceFuturesProduct.FromStrNativeProduct(symbol)


class BinanceFuturesHandler(BinanceHandlerBase):
  BookBuilderType = BinanceFuturesBookBuilder
  TraitsType = FuturesTraits
